from rest_framework.viewsets import ModelViewSet

from .filters import *
from .serializers import *


class GroupsView(ModelViewSet):
    queryset = Group.objects.all()
    serializer_class = GroupSerializer
    filter_fields = ('name',)


class UsersView(ModelViewSet):
    queryset = User.objects.all()
    serializer_class = UserSerializer
    filter_fields = (
        'is_superuser',
        'username',
        'first_name',
        'last_name',
        'email',
        'is_staff',
        'is_active',
    )


class BusinessView(ModelViewSet):
    queryset = Business.objects.all()
    serializer_class = BusinessSerializer
    filter_class = BusinessFilter


class EnvironmentView(ModelViewSet):
    queryset = Environment.objects.all()
    serializer_class = EnvironmentSerializer
    filter_class = EnvironmentFilter


class ApplicationView(ModelViewSet):
    queryset = Application.objects.all()
    serializer_class = ApplicationSerializer
    filter_class = ApplicationsFilter


class ApplicationTagView(ModelViewSet):
    queryset = ApplicationTag.objects.all()
    serializer_class = ApplicationTagSerializer
    filter_class = ApplicationsTagFilter


class InstancesView(ModelViewSet):
    queryset = Instances.objects.all()
    serializer_class = InstancesSerializer
    filter_class = InstancesFilter


class LanguageView(ModelViewSet):
    queryset = Language.objects.all()
    serializer_class = LanguageSerializer
    filter_class = LanguageFilter


class ResourceView(ModelViewSet):
    queryset = Resource.objects.all()
    serializer_class = ResourceSerializer
    filter_class = ResourceFilter
